import { defineStore } from 'pinia'
import { store } from '/@/store'
import type { AxiosResponse } from 'axios'
import type { Res } from '/@/tool/Res'
import type { Param } from '/@/tool/Param'

import actProcessChartService from '/@/api/cn/core/act/actProcessChartService'

import type { ActProcessChart } from '/@/model/cn/core/act/eo/ActProcessChart'
import type { ActProcessChartQO } from '/@/model/cn/core/act/qo/ActProcessChartQO'
import type { ActProcessChartVO } from '/@/model/cn/core/act/vo/ActProcessChartVO'

interface ActProcessChartState {
}

export const useActProcessChartStore = defineStore({
  id: 'actProcessChart',
  state: (): ActProcessChartState => ({
  }),
  getters: {
  },
  actions: {
    save(param: Param<ActProcessChart>): Promise<Res<ActProcessChart>> {
      return new Promise<Res<ActProcessChart>>((resolve, reject) => {
        actProcessChartService.save(param).then((res: AxiosResponse<Res<ActProcessChart>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    saveBatch(param: Param<ActProcessChart>): Promise<Res<ActProcessChart>> {
      return new Promise<Res<ActProcessChart>>((resolve, reject) => {
        actProcessChartService.saveBatch(param).then((res: AxiosResponse<Res<ActProcessChart>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    update(param: Param<ActProcessChart>): Promise<Res<ActProcessChart>> {
      return new Promise<Res<ActProcessChart>>((resolve, reject) => {
        actProcessChartService.update(param).then((res: AxiosResponse<Res<ActProcessChart>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    updateBatch(param: Param<ActProcessChart>): Promise<Res<ActProcessChart>> {
      return new Promise<Res<ActProcessChart>>((resolve, reject) => {
        actProcessChartService.updateBatch(param).then((res: AxiosResponse<Res<ActProcessChart>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    remove(param: Param<ActProcessChart>): Promise<Res<ActProcessChart>> {
      return new Promise<Res<ActProcessChart>>((resolve, reject) => {
        actProcessChartService.remove(param).then((res: AxiosResponse<Res<ActProcessChart>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    removeBatch(param: Param<ActProcessChart>): Promise<Res<ActProcessChart>> {
      return new Promise<Res<ActProcessChart>>((resolve, reject) => {
        actProcessChartService.removeBatch(param).then((res: AxiosResponse<Res<ActProcessChart>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    count(param: Param<ActProcessChartQO>): Promise<Res<ActProcessChart>> {
      return new Promise<Res<ActProcessChart>>((resolve, reject) => {
        actProcessChartService.count(param).then((res: AxiosResponse<Res<ActProcessChart>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    pk(param: Param<ActProcessChartQO>): Promise<Res<ActProcessChart>> {
      return new Promise<Res<ActProcessChart>>((resolve, reject) => {
        actProcessChartService.pk(param).then((res: AxiosResponse<Res<ActProcessChart>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    query(param: Param<ActProcessChartQO>): Promise<Res<ActProcessChart>> {
      return new Promise<Res<ActProcessChart>>((resolve, reject) => {
        actProcessChartService.query(param).then((res: AxiosResponse<Res<ActProcessChart>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    paging(param: Param<ActProcessChartQO>): Promise<Res<ActProcessChart>> {
      return new Promise<Res<ActProcessChart>>((resolve, reject) => {
        actProcessChartService.paging(param).then((res: AxiosResponse<Res<ActProcessChart>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    countVo(param: Param<ActProcessChartQO>): Promise<Res<ActProcessChartVO>> {
      return new Promise<Res<ActProcessChartVO>>((resolve, reject) => {
        actProcessChartService.countVo(param).then((res: AxiosResponse<Res<ActProcessChartVO>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    pkVo(param: Param<ActProcessChartQO>): Promise<Res<ActProcessChartVO>> {
      return new Promise<Res<ActProcessChartVO>>((resolve, reject) => {
        actProcessChartService.pkVo(param).then((res: AxiosResponse<Res<ActProcessChartVO>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    queryVo(param: Param<ActProcessChartQO>): Promise<Res<ActProcessChartVO>> {
      return new Promise<Res<ActProcessChartVO>>((resolve, reject) => {
        actProcessChartService.queryVo(param).then((res: AxiosResponse<Res<ActProcessChartVO>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
    pagingVo(param: Param<ActProcessChartQO>): Promise<Res<ActProcessChartVO>> {
      return new Promise<Res<ActProcessChartVO>>((resolve, reject) => {
        actProcessChartService.pagingVo(param).then((res: AxiosResponse<Res<ActProcessChartVO>>) => {
          resolve(res.data)
        }).catch(err => {
          reject(err)
        })
      })
    },
  },
})

export function useActProcessChartStoreWithout() {
  return useActProcessChartStore(store)
}
